package com.davidliao;

import java.util.Scanner;

public class Quadratic {

	public static void main(String[] args) {

		double a, b, c;
		Scanner scan = new Scanner(System.in);

		System.out.print("Please Input a, b, c : ");
		a = scan.nextDouble();
		b = scan.nextDouble();
		c = scan.nextDouble();
		scan.close();

		System.out.println("You just input : " + a + " " + " " + b + " " + c);

		qe(a, b, c);
	}

	/**
	 * 
	 * @param a double
	 * @param b double
	 * @param c double
	 * @return void
	 */

	public static void qe(double a, double b, double c) {

		double sqrtOfDis = Math.sqrt(b * b - 4 * a * c);

		Double x1 = (-b + sqrtOfDis) / (2 * a);
		Double x2 = (-b - sqrtOfDis) / (2 * a);

		if (x1.equals(Double.NaN) || x2.equals(Double.NaN)) {
			System.out.print("No solution!!!!");
		} else {
			System.out.println("Root1: " + x1);
			System.out.print("Root2: " + x2);
		}
	}
}
